package com.hmsproject.datastructures.deal;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.hmsproject.datastructures.event.Event;

public class Deal {
	
	private static int dealIdStatic = 0;
	
	public String getDealId() {
		return dealId;
	}
	
	public String getDealName() {
		return dealName;
	}
	public void setDealName(String dealName) {
		this.dealName = dealName;
	}
	public String getHotelId() {
		return hotelId;
	}
	public void setHotelId(String hotelId) {
		this.hotelId = hotelId;
	}

	private String dealId;
	private String dealName;
	private String hotelId;
	private DealDetails dealDetails;
	private List<Event> events;

	public List<Event> getEvents() {
		return events;
	}

	private Deal(){}
	
	public Deal(String dealName,String hotelId,DealDetails dealDetails, List<Event> events){
		this.dealName = dealName;
		this.hotelId = hotelId;
		this.dealDetails = dealDetails;
		this.events = events;
		
		this.dealId = dealIdStatic++ + ""; 
	}
	
	public boolean isActive(){
		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
	//	return dealDetails.getCutOff().after(new Date());
		return true;
	}

	public DealDetails getDealDetails() {
		return dealDetails;
	}
	
	public boolean insideRange(Date checkinDate, Date checkOutDate){
		boolean result = false;
		
		Event event = this.getEvents().get(0);
		
		//result = (!checkinDate.before(this.getEvents().get(0).getEventSchedule().getFromDate()) && !checkOutDate.after(this.getEvents().get(0).getEventSchedule().getToDate()));
		result = event.getEventSchedule().getFromDate().equals(checkinDate) && event.getEventSchedule().getToDate().equals(checkOutDate);
		
		return result;
	}
	
	public boolean insideRange(Date singleDate){
		boolean result = false;
		
		result = (!singleDate.before(this.getEvents().get(0).getEventSchedule().getFromDate()) && !singleDate.after(this.getEvents().get(0).getEventSchedule().getToDate()));
		
		return result;
	}	
	
	public boolean insideRange(){
		boolean result = false;
		
		return result;
	}	
	
}
